<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript">
get_check = function(){
	var ids = '';
	$("#list").find("input[type='checkbox']").each(function(){
		if ($(this).is(":checked"))
		{
			if (ids)
			{
				ids += ',';
			}
			ids += $(this).val();
		}
	});
	return ids;
};
$(function(){
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	$("#dialog_notes").dialog({autoOpen:false,modal:true});
	$("#dialog_print").dialog({autoOpen:false,modal:true});
	$(".more_click").mouseover(function(){
		$(this).next().show();
	}).mouseout(function(){
		$(this).next().hide();
	});
	$(".addnotes_click").click(function(){
		$("#notes_id").val($(this).next().next().val());
		$("#dialog_notes").dialog("open");
	});
	$(".more_content").mouseover(function(){
		$(this).show();
	}).mouseout(function(){
		$(this).hide();
	});
	$(".view").toggle(function(){
		$(this).parent().parent().next().show();
	},function(){
		$(this).parent().parent().next().hide();
	});
	$("#check_all").click(function(){
		if ($(this).is(":checked"))
		{
			$(".list_table input[type='checkbox']").attr("checked", true);
		}
		else
		{
			$(".list_table input[type='checkbox']").attr("checked", false);
		}
	});
	$(".print_btn").click(function(){
		var ids = get_check();
		if( ! ids)
		{
			alert('请选择订单！');
			return false;
		}
		if ($(this).val() == '单个拣货单')
		{
			$('#type').val(1);
		}
		else
		{
			$('#type').val(0);
		}
		$("#print_ids").val(ids);
		$("#dialog_print").dialog("open");
	});
	$("#print_EMS_btn").click(function(){
		var ids = get_check();
		if ( ! ids)
		{
			alert("请选择订单");
			return false;
		}
		$("#print_ids").val(ids);
		$("#print_form").attr("action", "<?=url('Storage::Sales/PrintEMS')?>").submit();
	});
	$("#print_DHL_btn").click(function(){
		var ids = get_check();
		if ( ! ids)
		{
			alert("请选择订单");
			return false;
		}
		$("#print_ids").val(ids);
		$("#print_form").attr("action", "<?=url('Storage::Sales/PrintDHL')?>").submit();
	});
	$("#multi_hold_btn").click(function(){
		var ids = get_check();
		if ( ! ids)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“滞留”？'))
		{
			return false;
		}
		window.location.href="<?=url('Storage::Sales/MultiHold', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>&ids=" + ids;
	});
	$("#multi_cancel_hold_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“返回销售确认”？'))
		{
			return false;
		}
		window.location.href="<?=url('Storage::Sales/MultiToCheckOut')?>&ids=" + ids;
	});
	$("#multi_to_sale_hold_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		$("#dialog_notes form").attr("action", "<?=url('Storage::Sales/MultiToSalesHold')?>");
		$("#notes_id").val(ids);
		$("#dialog_notes").dialog("open");
	});
	$("#multiout_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“出库”？'))
		{
			return false;
		}
		$("#multiout_ids").val(ids);
		$("#multiout_form").attr("action", "<?=url('Storage::Sales/MultiOut', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#multiexpress_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步出口易”？'))
		{
			return false;
		}
		if ( ! $("#CK1_order_type_select").val())
		{
			alert("请选择出口易订单方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#CK1_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressCK1')?>").submit();
	});
	$("#express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步均辉”？'))
		{
			return false;
		}
		if ( ! $("#JH_order_type_select").val())
		{
			alert("请选择均辉订单方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#JH_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressJH')?>").submit();
	});
	$("#MC_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步米巢”？'))
		{
			return false;
		}
		if ( ! $("#MC_order_type_select").val())
		{
			alert("请选择米巢订单方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#MC_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressMC')?>").submit();
	});
	$("#SFC_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步三态”？'))
		{
			return false;
		}
		if ( ! $("#SFC_order_type_select").val())
		{
			alert("请选择三态订单方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#SFC_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressSFC', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#QT_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步全通”？'))
		{
			return false;
		}
		if ( ! $("#QT_order_type_select").val())
		{
			alert("请选择全通订单方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#QT_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressQT', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#4PX_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步4PX”？'))
		{
			return false;
		}
		if ( ! $("#4PX_order_type_select").val())
		{
			alert("请选择4PX订单方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#4PX_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/Express4PX', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#Bpost_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步比利时邮政”？'))
		{
			return false;
		}
		if ( ! $("#Bpost_order_type_select").val())
		{
			alert("请选择比利时邮政订单方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#Bpost_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressBpost', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#BUB_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert('请选择订单');
			return false;
		}
		if ( ! confirm('确定把所选的单“同步贝邮宝”？'))
		{
			return false;
		}
		if ( ! $("#BUB_order_type_select").val())
		{
			alert('请选择贝邮宝邮寄方式');
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#BUB_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressBUB', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#SF_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert('请选择订单');
			return false;
		}
		if ( ! confirm('确定把所选的单“同步顺丰”？'))
		{
			return false;
		}
		if ( ! $("#SF_order_type_select").val())
		{
			alert('请选择顺丰邮寄方式');
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#SF_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressSF', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#AE_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert('请选择订单');
			return false;
		}
		if ( ! confirm('确定把所选的单“同步速卖通”？'))
		{
			return false;
		}
		if ( ! $("#AE_order_type_select").val())
		{
			alert('请选择速卖通邮寄方式');
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#AE_order_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressAE')?>").submit();
	});
	$("#HK_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert('请选择订单');
			return false;
		}
		if ( ! confirm('确定把所选的单“同步香港DHL”？'))
		{
			return false;
		}
		$("#info").val(ids);
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressHK')?>").submit();
	});
	$("#return_AE_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定获取同步所选的单？'))
		{
			return false;
		}
		window.location.href="<?=url('Storage::Sales/GetAEOrderTrackingNum')?>&ids=" + ids;
	});
	$("#BY_express_btn").click(function(){
		var ids = get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		if ( ! confirm('确定把所选的单“同步贝易”？'))
		{
			return false;
		}
		if ( ! $("#BY_order_type_select").val())
		{
			alert("请选择订单方式");
			return false;
		}
		if ( ! $("#BY_post_type_select").val())
		{
			alert("请选择邮寄方式");
			return false;
		}
		$("#info").val(ids);
		$("#order_type").val($("#BY_order_type_select").val());
		$("#post_type").val($("#BY_post_type_select").val());
		$("#action_form").attr("action", "<?=url('Storage::Sales/ExpressBY', array(Q::ini('unique_token_name')=>Helper_BSS_Normal::genToken()))?>").submit();
	});
	$("#BY_order_export_btn").click(function(){
		var ids=get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		window.location.href="<?=url('Storage::Sales/ExportBYOrderInfo')?>&ids=" + ids;
	});
	$("#request_download").click(function(){window.location.href="<?=url('Storage::Sales/ExportOrderWeightInfo', array('url_arr_json' => $url_arr_json))?>";});
	$("#JH_export_btn").click(function(){window.location.href="<?=url('Storage::Sales/ExportJHOrderInfo', array('url_arr_json' => $url_arr_json))?>";});
	$("#FLYT_export_btn").click(function(){window.location.href="<?=url('Storage::Sales/ExportFLYTOrderInfo', array('url_arr_json' => $url_arr_json))?>";});
	$("#SY_export_btn").click(function(){window.location.href="<?=url('Storage::Sales/ExportSYOrderInfo', array('url_arr_json' => $url_arr_json))?>";});
	$("#MC_export_btn").click(function(){window.location.href="<?=url('Storage::Sales/ExportMCOrderInfo', array('url_arr_json' => $url_arr_json))?>";});
	$("#EUB_export_btn").click(function(){
		var ids=get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		window.location.href="<?=url('Storage::Sales/ExportEUBOrderInfo')?>&ids=" + ids;
	});
	$("#MY_export_btn").click(function(){
		var ids=get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		window.location.href="<?=url('Storage::Sales/ExportMYOrderInfo')?>&ids=" + ids;
	});
	$("#BUB_export_btn").click(function(){
		var ids=get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		window.location.href="<?=url('Storage::Sales/ExportBUBOrderInfo')?>&ids=" + ids;
	});
	$("#GLS_export_btn").click(function(){
		var ids=get_check();
		if (ids.length == 0)
		{
			alert("请选择订单");
			return false;
		}
		window.location.href="<?=url('Storage::Sales/ExportGLSOrderInfo')?>&ids=" + ids;
	});
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<?include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>确认日期</th>
	<td>
		<input type="text" class="datepicker" name="begin_checkout_time" value="<?=isset($_GET['begin_checkout_time']) ? $_GET['begin_checkout_time'] : ''?>" /> to
		<input type="text" class="datepicker" name="end_checkout_time" value="<?=isset($_GET['end_checkout_time']) ? $_GET['end_checkout_time'] : ''?>" />
	</td>
	<th>订单重量(g)</th>
	<td>
		<select name="weight_operator">
			<option value="">请选择..</option>
			<option value="=" <?if(isset($_GET['weight_operator'])&&$_GET['weight_operator']=='=')echo "selected='selected'"?>>=</option>
			<option value=">=" <?if(isset($_GET['weight_operator'])&&$_GET['weight_operator']=='>=')echo "selected='selected'"?>>&gt;=</option>
			<option value="<=" <?if(isset($_GET['weight_operator'])&&$_GET['weight_operator']=='<=')echo "selected='selected'"?>>&lt;=</option>
		</select>
		<input type="text" name="weight" value="<?=isset($_GET['weight']) ? $_GET['weight']:''?>" />
	</td>
</tr>
<tr>
	<th>网站/店铺</th>
	<td>
		<select name="shop_id">
			<option value=""></option>
			<?foreach ($shop as $s):?>
			<option value="<?=$s['id']?>" <?if (isset($_GET['shop_id']) && $_GET['shop_id']==$s['id']) echo "selected='selected'"?>><?=$s['name']?></option>
			<?endforeach;?>
		</select>
	</td>
	<th>产品编号</th>
	<td><input type="text" name="product_number" value="<?=isset($_GET['product_number']) ? $_GET['product_number'] : ''?>" /></td>
</tr>
<tr>
	<th>本地单号</th>
	<td><input type="text" name="number" value="<?=isset($_GET['number']) ? $_GET['number'] : ''?>" /></td>
	<th>网站单号</th>
	<td><input type="text" name="shop_order_number" value="<?=isset($_GET['shop_order_number']) ? $_GET['shop_order_number'] : ''?>" /></td>
</tr>
<tr>
	<th>买家ID</th>
	<td><input type="text" name="shop_buyer_id" value="<?=isset($_GET['shop_buyer_id']) ? $_GET['shop_buyer_id'] : ''?>" /></td>
	<th>买家全名</th>
	<td><input type="text" name="fullname" value="<?=isset($_GET['fullname']) ? $_GET['fullname'] : ''?>" /></td>
</tr>
<tr>
	<th>架位</th>
	<td><input type="text" name="sort_shelf_position" value="<?=isset($_GET['sort_shelf_position']) ? $_GET['sort_shelf_position'] : ''?>" /></td>
	<th>国家</th>
	<td>
		<select name="country">
			<option value=""></option>
			<option value="United States" <?if (isset($_GET['country']) && $_GET['country'] == 'United States')echo "selected='selected'";?>>美国</option>
			<option value="United Kingdom" <?if (isset($_GET['country']) && $_GET['country'] == 'United Kingdom')echo "selected='selected'";?>>英国</option>
			<option value="Australia" <?if (isset($_GET['country']) && $_GET['country'] == 'Australia')echo "selected='selected'";?>>澳大利亚</option>
			<option value="Russian Federation" <?if (isset($_GET['country']) && $_GET['country'] == 'Russian Federation')echo "selected='selected'";?>>俄罗斯联邦</option>
			<option value="Germany" <?if (isset($_GET['country']) && $_GET['country'] == 'Germany')echo "selected='selected'";?>>德国</option>
		</select>
	</td>
</tr>
<tr>
	<th>追踪号</th>
	<td><input type="text" name="tracking_number" value="<?=isset($_GET['tracking_number']) ? $_GET['tracking_number'] : ''?>" /></td>
	<td colspan="2"></td>
</tr>
<tr>
	<th width="60">邮寄方式</th>
	<td colspan="3">
		<?foreach ($shipping_method as $sm):?>
		<label><input type="checkbox" name="shipping_method[<?=$sm['id']?>]" value="<?=$sm['id']?>" <?if (isset($_GET['shipping_method']) && array_key_exists($sm['id'], $_GET['shipping_method'])) echo "checked='checked'"?> /> <?=$sm['name']?></label>
		<?endforeach;?>
	</td>
</tr>
<tr>
	<th>订单状态</th>
	<td colspan="3">
		<?foreach (Q::ini('custom_flag/sales_order_handle_status') as $os):?>
		<?if ($os['value']>=5):?>
		<label><input type="checkbox" name="order_status[<?=$os['value']?>]" value="<?=$os['value']?>" <?if (isset($_GET['order_status']) &&  array_key_exists($os['value'], $_GET['order_status'])) echo "checked='checked'"?> /> <?=$os['name']?></label>
		<?endif;?>
		<?endforeach;?>
	</td>
</tr>
<tr>
	<th>是否同步</th>
	<td>
		<label><input type="checkbox" name="is_express[1]" value="1" <?if(isset($_GET['is_express']) && array_key_exists(1, $_GET['is_express'])) echo "checked='checked'";?> /> 未同步</label>
		<label><input type="checkbox" name="is_express[2]" value="2" <?if(isset($_GET['is_express']) && array_key_exists(2, $_GET['is_express'])) echo "checked='checked'";?> /> 已同步</label>
	</td>
</tr>
<tr>
	<th>追踪号</th>
	<td>
		<label><input type="checkbox" name="is_tracking_number[1]" value="1" <?if(isset($_GET['is_tracking_number']) && array_key_exists(1, $_GET['is_tracking_number'])) echo "checked='checked'"?> /> 无</label>
		<label><input type="checkbox" name="is_tracking_number[2]" value="2" <?if(isset($_GET['is_tracking_number']) && array_key_exists(2, $_GET['is_tracking_number'])) echo "checked='checked'"?> /> 有</label>
	</td>
</tr>
<tr>
	<th>提示标志</th>
	<td>
		<?foreach (Q::ini('custom_flag/sales_order_tips_flag') as $sotf):?>
		<label><input type="checkbox" name="wanted_edit[<?=$sotf['value']?>]" value="<?=$sotf['value']?>" <?if (isset($_GET['wanted_edit']) &&  array_key_exists($sotf['value'], $_GET['wanted_edit'])) echo "checked='checked'"?> /> <?=$sotf['name']?></label>
		<?endforeach;?>
	</td>
</tr>
<tr>
	<th>产品数量</th>
	<td>
		<label><input type="checkbox" name="product_quantity_area[single]" value="single" <?if(isset($_GET['product_quantity_area']) && array_key_exists('single', $_GET['product_quantity_area'])) echo "checked='checked'";?> /> 单个</label>
		<label><input type="checkbox" name="product_quantity_area[multi]" value="multi" <?if(isset($_GET['product_quantity_area']) && array_key_exists('multi', $_GET['product_quantity_area'])) echo "checked='checked'";?> /> 多个</label>
	</td>
</tr>
<tr>
	<td><input type="hidden" name="is_search" value="1" /></td>
	<td><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<table width="100%" class="list_table" id="list">
<tr>
	<th width="30"></th>
	<th width="100">本地单号</th>
	<th>网站</th>
	<th>网站单号</th>
	<th>买家ID</th>
	<th width="130">确认日期</th>
	<th>邮寄方式</th>
	<th>重量</th>
	<th width="120">状态</th>
	<th width="120">操作</th>
</tr>
<?foreach ($sales_order as $so):?>
<tr <?if($so['warning']):?>style="background-color: #ff8800;"<?endif;?>>
	<td><input type="checkbox" value="<?=$so['id']?>" /></td>
	<td><?=$so['number']?></td>
	<td><?=$so['shop_name']?></td>
	<td><?=$so['shop_order_number']?></td>
	<td><?=$so['shop_buyer_id']?></td>
	<td title="销售时间：<?=$so['sales_time'] ? $so['sales_time'] : ''?> <?=$so['sales_user_name']?> 
制单时间：<?=$so['make_time'] ? $so['make_time'] : ''?> <?=$so['make_user_name']?>   
销售确认：<?=$so['checkout_time'] ? $so['checkout_time'] : ''?> <?=$so['checkout_user_name']?> 
打拣货单：<?=$so['print_time'] ? $so['print_time'] : ''?> <?=$so['print_user_name']?> 
打地址单：<?=$so['print_address_time'] ? $so['print_address_time'] : ''?> <?=$so['print_address_user_name']?>  
仓库称重：<?=$so['weigh_time'] ? $so['weigh_time'] : ''?> <?=$so['weigh_user_name']?>	
拣货人：<?=$so['pick_user_name'] ? $so['pick_user_name'] : ''?>	
包货人：<?=$so['pack_user_name'] ? $so['pack_user_name'] : ''?>"><?=$so['checkout_time'] ?>	
	</td>
	<td><?=$so['shipping_method_name']?></td>
	<td><?=sprintf('%.2f',$so['weight'])?>g</td>
	<td>
		<?=Helper_BSS_Normal::getIniOne('sales_order_handle_status', 'value', $so['handle_status'], 'name')?>
		<span class="<?=Helper_BSS_Normal::getIniOne('sales_order_handle_status', 'value', $so['handle_status'], 'icon_class')?>"></span>
		<?if ($so['has_sales_notes']):?><span class="sales_notes_icon"></span><?endif;?>
		<?if ($so['has_warehouse_notes']):?><span class="warehouse_notes_icon"></span><?endif;?>
		<?foreach (Q::ini('custom_flag/sales_order_synchronous_flag') as $sf):?>
		<?if($so['synchronous_flag'] == $sf['value']):?><div><font color="green"><?=$sf['name']?></font><span class="express_icon"></span></div><?endif;?>
		<?endforeach;?>
		<?if ($so['tips_flag']):?><span class="<?=Helper_BSS_Normal::getIniOne('sales_order_tips_flag', 'value', $so['tips_flag'], 'icon_class')?>"></span><?endif;?>
	</td>
	<td>
		<a class="view" href="javascript:void(0);">查看</a>
		<a class="addnotes_click">备注</a>
		<a href="<?=url('Storage::Sales/PrintAddress', array('id' => $so['id']))?>" target="_blank">打地址单</a>
		<input type="hidden" value="<?=$so['id']?>" />
	</td>
</tr>
<tr class="detail" style="display: none;">
	<td colspan="25">
		<table width="100%" class="list_table">
			<tr>
				<th width="15%">仓库</th>
				<td width="35%"><?=$so['warehouse_name']?></td>
				<th width="15%">制单人</th>
				<td width="35%"><?=$so['make_user_name']?></td>
			</tr>
			<tr>
				<th width="15%">发货类型</th>
				<td width="35%"><?=Helper_BSS_Normal::getIniOne('sales_order_send_method', 'value', $so['send_method'], 'name')?></td>
				<th>支付方式</th>
				<td><?=Helper_BSS_Normal::getIniOne('sales_order_payment_method', 'value', $so['payment_method'], 'name')?></td>
			</tr>
			<tr>
				<th>邮寄方式</th>
				<td><?=$so['shipping_method_name']?></td>
				<th>交易号</th>
				<td><?=$so['transaction_id']?></td>
			</tr>
			<tr>
				<th>买家姓名</th>
				<td><?=$so['fullname']?></td>
				<th>买家Email</th>
				<td><?=$so['email']?></td>
			</tr>
			<tr>
				<th>买家电话</th>
				<td><?=$so['phone']?></td>
				<th>收货地址1</th>
				<td><?=$so['street1']?></td>
			</tr>
			<tr>
				<th>收货地址2</th>
				<td><?=$so['street2']?></td>
				<th>城市</th>
				<td><?=$so['city']?></td>
			</tr>
			<tr>
				<th>州/省</th>
				<td><?=$so['state']?></td>
				<th>邮政编码</th>
				<td><?=$so['zip']?></td>
			</tr>
			<tr>
				<th>国家</th>
				<td><?=$so['country']?></td>
				<th>国家(中文)</th>
				<td><?=$so['country_cn']?></td>
			</tr>
			<tr>
				<th>运费</th>
				<td><?=$so['currency_symbol']?><?=sprintf('%.2f', $so['shipping_fee'])?></td>
				<th>折扣</th>
				<td><?=$so['currency_symbol']?><?=sprintf('%.2f', $so['discount'])?></td>
			</tr>
			<?if ($so['address_notes']):?>
			<tr>
				<th>地址备注</th>
				<td align="left" colspan="3"><?=$so['address_notes']?></td>
			</tr>
			<?endif;?>
			<?if ($so['sales_notes']):?>
			<tr>
				<th>销售备注</th>
				<td align="left" colspan="3">
				<?foreach ($so['sales_notes'] as $ssn):?>
				<p><?=$ssn['notes_name']?>(<?=$ssn['add_time']?>):<?=$ssn['notes']?></p>
				<?endforeach;?>
				</td>
			</tr>
			<?endif;?>
			<?if ($so['warehouse_notes']):?>
			<tr>
				<th>仓库备注</th>
				<td align="left" colspan="3">
				<?foreach ($so['warehouse_notes'] as $ssn):?>
				<p><?=$ssn['notes_name']?>(<?=$ssn['add_time']?>):<?=$ssn['notes']?></p>
				<?endforeach;?>
				</td>
			</tr>
			<?endif;?>
			<?if ($so['customer_notes']):?>
			<tr>
				<th>客人备注</th>
				<td align="left" colspan="3">
				<?foreach($so['customer_notes'] as $scn):?>
				<p><?=$scn['notes']?></p>
				<?endforeach;?>
				</td>
			</tr>
			<?endif;?>
		</table>
		<div align="left"><strong>销售订单产品信息</strong></div>
		<table width="100%" class="list_table">
			<tr>
				<th>产品编号</th>
				<th>数量</th>
				<th>可用库存</th>
				<th>ShopItemId</th>
				<th>ShopTransactionId</th>
			</tr>
			<?$total_quantity = 0;?>
			<?foreach ($so['item'] as $soi):?>
			<?$total_quantity += $soi['quantity']?>
			<tr>
				<td>
					<?=$soi['number']?>
					<?if ($soi['pic_url']):?>
						<?$pretty_photo_number = 0;?>
						<?foreach ($soi['pic_url'] as $soip):?>
						<a rel="pretty_photo[<?=$soi['id']?>]" href="<?=$soip?>"><?if(!$pretty_photo_number):?><span class="img_icon"></span><?endif;?></a>
						<?$pretty_photo_number = 1;?>
						<?endforeach;?>
					<?endif;?>
				</td>
				<td><?=$soi['quantity']?></td>
				<td><?=($soi['available_quantity']<$soi['quantity']) ? "<span class='red'>{$soi['available_quantity']}</span>" : $soi['available_quantity'] ?></td>
				<td><?=$soi['shop_item_id']?></td>
				<td><?=$soi['shop_transaction_id']?></td>
			</tr>
			<?endforeach;?>
			<tr>
				<td colspan="1">小计</td>
				<td><?=$total_quantity?></td>
				<td colspan="4"></td>
			</tr>
		</table>
	</td>
</tr>
<?endforeach;?>
</table>
<?=$page?>
<?if (isset($postage)):?>
<?$weight = $postage_amount_cny = 0;?>
<?$postage_amount = array();?>
<?foreach ($postage as $p):?>
<?$weight += $p['weight'];?>
<?$postage_amount_cny += $p['postage_amount_cny'];?>
<?$postage_amount[] = '<strong>' . $p['code'] . '：</strong>' . (isset($p['postage_amount']) ? sprintf('%.2f', $p['postage_amount']) : '0.00');?>
<?endforeach;?>
搜索条件总重量：<strong><?=sprintf('%.3f', $weight/1000)?> KG</strong><br />
搜索条件总物流费用：<?=implode(' + ', $postage_amount) . ' = <strong>CNY：</strong>' . sprintf('%.2f', $postage_amount_cny);?>
<?endif;?>
<table class="list_table">
<tr>
	<td rowspan="15"><label><input type="checkbox" id="check_all" />全选</label></td>
	<td align="left">
		<input type="button" class="button" id="multi_hold_btn" value="滞留" /> |
		取消滞留： 
		<input type="button" class="button" id="multi_cancel_hold_btn" value="销售确认" />
		<input type="button" class="button" id="multi_to_sale_hold_btn" value="销售滞留" /> |
		<input type="button" class="button" id="multiout_btn" value="转为出库" />
	</td>
</tr>
<tr>
	<td align="left">打印：
		<input type="button" class="button print_btn" value="单个拣货单" /> | 
		<input type="button" class="button print_btn" value="多个拣货单" /> | 
		<input type="button" class="button" id="print_EMS_btn" value="EMS" /> |
		<input type="button" class="button" id="print_DHL_btn" value="DHL" />
	</td>
</tr>
<tr>
	<td align="left">按搜索条件导出：
		<input type="button" class="button" value="重量信息" id="request_download" />
		<input type="button" class="button" value="均辉模板" id="JH_export_btn" />
		<input type="button" class="button" value="飞特模板" id="FLYT_export_btn" />
		<input type="button" class="button" value="顺邮模板" id="SY_export_btn" />
		<input type="button" class="button" value="米巢模板" id="MC_export_btn" />
	</td>
</tr>
<tr>
	<td align="left">按勾选导出：
		<input type="button" class="button" value="EUB模板" id="EUB_export_btn" />
		<input type="button" class="button" value="马邮模板" id="MY_export_btn" />
		<input type="button" class="button" value="贝邮宝模板" id="BUB_export_btn" />
		<input type="button" class="button" value="GLS模板" id="GLS_export_btn" />
	</td>
</tr>
<tr>
	<td align="left">
		全通订单方式：<select id="QT_order_type_select">
		<option value="">请选择..</option>
		<?foreach (Q::ini('custom_flag/qt_order_type') as $ot):?>
		<option value="<?=$ot['value']?>"><?=$ot['name']?></option>
		<?endforeach;?>
		</select>
		<input type="button"  class="button" id="QT_express_btn" value="同步全通" />
	</td>
</tr>
<tr>
	<td align="left">
		三态订单方式：<select id="SFC_order_type_select">
		<option value="">请选择..</option>
		<?foreach (Q::ini('custom_flag/SFC_order_type') as $ot):?>
		<option value="<?=$ot['value']?>"><?=$ot['name']?></option>
		<?endforeach;?>
		</select>
		<input type="button"  class="button" id="SFC_express_btn" value="同步三态" />
	</td>
</tr>
<tr>
	<td align="left">
		4PX订单方式：<select id="4PX_order_type_select">
		<option value="">请选择..</option>
		<?foreach (Q::ini('custom_flag/4PX_order_type') as $ot):?>
		<option value="<?=$ot['value']?>"><?=$ot['name']?></option>
		<?endforeach;?>
		</select>
		<input type="button"  class="button" id="4PX_express_btn" value="同步4PX" />
	</td>
</tr>
<tr>
	<td align="left">
		贝易订单方式：<select id="BY_order_type_select">
		<option value="">请选择</option>
		<?foreach (Q::ini('custom_flag/by_order_type') as $ot):?>
		<option value="<?=$ot['code']?>" ><?=$ot['name']?></option>
		<?endforeach;?>
		</select>
		邮寄方式：<select id="BY_post_type_select">
		<option value="">请选择</option>
		<?foreach (Q::ini('custom_flag/sync_post_type') as $pt):?>
		<option value="<?=$pt['value']?>" ><?=$pt['name']?></option>
		<?endforeach;?>
		</select>
		<input type="button"  class="button" id="BY_express_btn" value="同步贝易" />
		<input type="button"  class="button" id="BY_order_export_btn" value="导出订单" />
	</td>
</tr>
<tr>
	<td align="left">
		比利时邮政订单方式：<select id="Bpost_order_type_select">
		<option value="">请选择..</option>
		<?foreach (Q::ini('custom_flag/Bpost_order_type') as $ot):?>
		<option value="<?=$ot['value']?>"><?=$ot['name']?></option>
		<?endforeach;?>
		</select>
		<input type="button"  class="button" id="Bpost_express_btn" value="同步比利时" />
	</td>
</tr>
<tr>
	<td align="left">
	贝邮宝订单方式：<select id="BUB_order_type_select">
	<option value="">请选择..</option>
	<?foreach (Q::ini('custom_flag/BUB_order_type') as $ot):?>
	<option value="<?=$ot['value']?>" /><?=$ot['name']?></option>
	<?endforeach;?>
	</select>
	<input type="button" class="button" id="BUB_express_btn" value="同步贝邮宝" />
	</td>
</tr>
<tr>
	<td align="left">
	顺丰订单方式：<select id="SF_order_type_select">
	<option value="">请选择..</option>
	<?foreach (Q::ini('custom_flag/SF_order_type') as $ot):?>
	<option value="<?=$ot['value']?>" /><?=$ot['name']?></option>
	<?endforeach;?>
	</select>
	<input type="button" class="button" id="SF_express_btn" value="同步顺丰" />
	</td>
</tr>
<tr>
	<td align="left">
	速卖通订单方式：<select id="AE_order_type_select">
	<option value="">请选择..</option>
	<?foreach (Q::ini('custom_flag/AE_order_type') as $ot):?>
	<option value="<?=$ot['value']?>" /><?=$ot['name']?></option>
	<?endforeach;?>
	</select>
	<input type="button" class="button" id="AE_express_btn" value="同步速卖通" /> | 
	速卖通订单：
	<input type="button" class="button" id="return_AE_express_btn" value="获取追踪号" />
	</td>
</tr>
<tr>
	<td align="left">
	香港DHL订单方式：<input type="button" class="button" id="HK_express_btn" value="同步香港DHL" />
	</td>
</tr>
<tr>
	<td align="left">中邮挂号订单：
		<a href="<?=url('Storage::Sales/TrackingNumberToSY')?>"><input type="button" class="button" value="分配追踪号" /></a>
	</td>
</tr>
</table>
<div id="dialog_notes" title="填写备注">
<form method="post" action="<?=url('Storage::Sales/AddNotes')?>">
<input type="hidden" name="id" id="notes_id" value="" />
<textarea name="notes_content" rows="3" cols="30"></textarea>
<input type="submit" value="添加备注" class="button" />
</form>
</div>
<form id="action_form" action="" method="post">
<input type="hidden" name="info" id="info" value="" />
<input type="hidden" name="order_type" id="order_type" value="" />
<input type="hidden" name="post_type" id="post_type" value="" />
</form>
<div id="dialog_print" title="选择拣货人">
<form id="print_form" action="<?=url('Storage::Sales/Print')?>" method="post" target="_blank">
<select name="pick_user_id">
<?foreach ($user as $u):?>
<option value="<?=$u['id']?>"><?=$u['name']?></option>
<?endforeach;?>
</select>
<input type="hidden" name="ids" id="print_ids"/>
<input type="hidden" name="type" id="type" />
<input type="submit" value="确定" class="button" />
</form>
</div>
<form id="multiout_form" action="" method="post">
<input type="hidden" name="ids" id="multiout_ids" value="" />
</form>
<?php $this->_endblock(); ?> 